<template>
    <Table border :columns="columns1" :data="data1"></Table>
</template>
<script>
    export default {
        data () {
            return {
                columns1: [
                     {
                        title: '序号',
                        key: 'id'
                    },
                     {
                        title: '手机号',
                        key: 'phone'
                    },
                    {
                        title: '姓名',
                        key: 'name',
                        render (row, column, index) {
                            return `<Icon type="person"></Icon> <strong>${row.name}</strong>`;
                        }
                    },
                    
                    {
                        title: '身份证号码',
                        key: 'card'
                    },
                    {
                        title: '身份认证',
                        key: 'cardState'
                    },{
                        title: '会员支付',
                        key: 'payState'
                    },
                    {
                        title: '推荐用户数',
                        key: 'coverRecommend'
                    },
                     {
                        title: '上线',
                        key: 'online'
                    },
                    {
                        title: '我的推荐码',
                        key: 'myRecommend'
                    },{
                        title: '状态',
                        key: 'state'
                    },
                    {
                        title: '操作',
                        key: 'action',
                        width: 150,
                        align: 'center',
                        render (row, column, index) {
                            return `<i-button type="primary" size="small" @click="show(${index})">编辑</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`;
                        }
                    }
                ],
                data1: [
                    {
                        name: '',
                        phone: 18,
                        card: '',
                        myRecommend:'',
                        cardState:''
                    }
                ]
            }
        },
          mounted: function () {
            this.$http.get("http://www.htmlk.cn:80/userlistAll").then((response) => {
                  console.log(response.data)
                  this.$data.data1=response.data
                })
        }, 

        methods: {
            show (index) {
               var id=this.data1[index].id
               this.$router.push({ name: 'userupdate', params: { id: id }})
            },
            remove (index) {
                this.data6.splice(index, 1);
            }
        }
    }
</script>